{% load wlcore_tags %}

{% if current_page.has_previous or current_page.has_next %}
    <ul class="am-pagination">
        <li class="page-info am-disabled">
            <span>第 {{ current_page.number }} / {{ current_page.paginator.num_pages }} 页</span>
        </li>
        {% if current_page.has_previous %}
            <li>
                <a href="?{{ page_var }}=1{% if querystring %}&{{ querystring }}{% endif %}" title="首页">
                    <span class="am-icon-angle-double-left"></span></a>
            </li>
            <li>
                <a href="?{% wlspaceless %}
                    {{ page_var }}=
                    {{ current_page.previous_page_number }}{% if querystring %}&{{ querystring }}{% endif %}
                    {% endwlspaceless %}"
                   title="上页"><span class="am-icon-angle-left"></span></a>
            </li>
        {% endif %}
        {% for page in current_page.visible_page_range %}
            {% if page == current_page.number %}
                <li class="am-active"><a>{{ page }}</a></li>
            {% else %}
                <li>
                    <a href="?{{ page_var }}={{ page }}{% if querystring %}&{{ querystring }}{% endif %}">
                        {{ page }}</a>
                </li>
            {% endif %}
        {% endfor %}
        {% if current_page.has_next %}
            <li>
                <a href="?{% wlspaceless %}
                    {{ page_var }}=
                    {{ current_page.next_page_number }}{% if querystring %}&{{ querystring }}{% endif %}
                    {% endwlspaceless %}"
                   title="下页"><span class="am-icon-angle-right"></span></a>
            </li>
            <li>
                <a href="?{% wlspaceless %}
                        {{ page_var }}=
                        {{ current_page.paginator.num_pages }}{% if querystring %}&{{ querystring }}{% endif %}
                        {% endwlspaceless %}"
                   title="尾页"><span class="am-icon-angle-double-right"></span></a>
            </li>
        {% endif %}
    </ul>
{% endif %}
